@extends('app')

@section('content')
<ul class="nav nav-tabs">
    <li><a href="{{ url('/admin/content/module')}}">列表</a></li>
    <li class="active"><a href="{{ url('/admin/content/module/create') }}">添加</a></li>
</ul>
<form method="POST" action="{{ url('/admin/content/module') }}">
<div class="panel panel-default mt20">

    <div class="table-responsive panel-body">
     <table class="table table-hover">
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">模块名称:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input type="text" class="form-control" name="name" id="name" >
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">英文名称:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input type="text" class="form-control" name="alias" id="alias" >
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">模块简介:</span>
                    <div class="col-sm-5 col-xs-8">
                        <textarea class="form-control" rows="5" name="intro" ></textarea>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">详细介绍:</span>
                    <div class="col-sm-5 col-xs-8">
                        <textarea class="form-control" rows="5" name="description" ></textarea>
                    </div>
                     <div class="help-block" >鼠标划过时，切换卡片将会显示改内容</div>
                </div>
            </td>
        </tr>
         <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">模块首页:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input type="text" class="form-control" name="link">
                        <div class="help-block" >点击图片将会跳转至该地址</div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">模块图片:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input id="uploadimg" name="uploadimg" type="file" multiple="true" />
                        <div id="imgbox" class="dustbin">
                           
                            <div style="width:90px; height:60px;">
                                <img width="90" height="60" src="" />
                                <input type='hidden' name='image_url' value='' />
                            </div>
                        </div>
                        <div class="help-block" >图片尺寸请保证为 595 * 295。前两张图片 左边为透明，后面两张图片为 右边透明。</div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">按钮名称:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input type="text" class="form-control" name="button">
                        <div class="help-block" >第二层效果图上面的 按钮 名称</div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">按钮动作:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input type="text" class="form-control" name="action">
                        <div class="help-block" >第二层效果图上面的按钮所对应的动作链接，为空，跳转对应模块的 创建功能</div>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="form-group">
                    <span class="col-sm-4 col-xs-3 control-label">排序:</span>
                    <div class="col-sm-5 col-xs-8">
                        <input type="text" class="form-control" name="sort" value="">
                        <div class="help-block" >越大越靠前</div>
                    </div>
                </div>
            </td>
        </tr>
    </table>
    </div>
</div>
    <input type="hidden" name="blademode" value="{{ $blademode }}">
    {!! csrf_field() !!}
    <div class="form-inline">
        <div class="form-group">
          <input type="submit" class="btn btn-primary btn-block" id="save" value="保存" />
        </div>
        <div class="form-group ml30">
            <input type="reset" class="btn btn-default btn-block" value="重置" />
        </div>
    </div>
</form>

<script type="text/javascript">
<!--
$(function(){
	/***图片上传****/
	$("#uploadimg").uploadify({
	    'formData'     : {
	        'fileField':'upfile',
	        '_token':'{{ csrf_token() }}',
	        'type':'index'
	    },
	    "width"           : 120,
	    "height"          : 30,
	    "queueSizeLimit"  :1,
	    "swf"             : "{{ asset('/js/uploadify/uploadify.swf') }}",
	    "fileObjName"     : "upfile",
	    "buttonText"      : "上传图片",
	    "uploader"        : '/admin/upload/newsimage',
	    'removeTimeout'	  : 1,
	    'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
	    'onUploadSuccess':function(file, data, response){
	    	var data = eval('(' + data + ')');
	        if (data.status == 'success') {

	        	var html="<div style='width:90px; height:60px;float:left;'>"
	            			+"<img width='90' height='60' src='"+data.url+"'  /><input type='hidden' name='image_url' value='"+data.url+"' />"
	            			+"</div>"
	            $('#imgbox').html(html);
	        }else{
	            alert(data.msg);
	            return false;
	        }

	    }

	});
});
//-->
</script>
@endsection
